package com.zht.controller;

import com.zht.common.Result;
import com.zht.pojo.dto.LoginReqDTO;
import com.zht.pojo.vo.LoginRespVO;
import com.zht.service.impl.LoginServiceImpl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; // 导入 @RequestBody
import org.springframework.web.bind.annotation.RestController;

@RestController
@AllArgsConstructor
@Slf4j
public class LoginController {
    private final LoginServiceImpl loginService;

    @PostMapping("/login")
    public Result<LoginRespVO> login(@RequestBody LoginReqDTO loginRequest) { // 加上 @RequestBody
        LoginRespVO loginResponse = loginService.login(loginRequest);
        return Result.ok(loginResponse);
    }
}